<template>
	<view class="content">
		<view v-if="type==1" class="block list-block">
			<navigator hover-class="none" :url="'/pages/article/detail?id='+item.id" class="list-item article-item"
				v-for="(item,index) in list1" :key="item.id">
				<image mode="aspectFill" :src="item.picUrl" class="cover-photo"></image>
				<view class="info">
					<view class="title overflow-line">{{item.title}}</view>
					<view class="time">发布时间：{{item.crtTime}}</view>
				</view>
			</navigator>
		</view>
	</view>
</template>

<script>
	import {
		getNoticeList
	} from '@/api/article.js';
	export default {
		data() {
			return {
				list1: [],
				type: 1,
				typeName: 0,
			}
		},
		onLoad(e) {
			this.type = e.type;
			this.typeName = e.typeName;
			uni.setNavigationBarTitle({
				title: e.name
			})
			this.NoticeList()
		},
		methods: {
			NoticeList() {
				getNoticeList({
					typeName: this.typeName
				}).then((res) => {
					if (res.code == 1) {
						if (res.data != null) {
							this.list1 = res.data;
						}
					} else {
						console.log(res)
					}
				}).catch((res) => {
					console.log(res)
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #FAFAFA;
	}

	.content {
		width: 100%;
		padding: 0 30rpx;

		.list-block.block {
			margin-top: 30rpx;
			width: 100%;
			display: flex;
			flex-direction: column;

			.list-item.article-item {
				height: 220rpx;
				width: 100%;
				padding: 30rpx 0;
				display: flex;
				flex-direction: row;
				border-radius: 20rpx;
				background: #fff;
				margin-bottom: 30rpx;
				padding: 20rpx;
				box-shadow: 0 0 10px 0 #efefef;

				.cover-photo {
					width: 180rpx;
					height: 180rpx;
					border-radius: 10rpx;
					margin-right: 20rpx;
					background: #efefef;
				}

				.info {
					width: calc(100% - 200rpx);
					height: 100%;

					.title {
						font-weight: bold;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 2;
						overflow: hidden;
					}

					.abstract {
						font-size: 24rpx;
						color: #999;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 1;
						overflow: hidden;
						margin-top: 10rpx;
						line-height: 1.5;
					}

					.time {
						margin-top: 60rpx;
						font-size: 28rpx;
						color: #999;
					}
				}
			}
		}
	}
</style>